package com.bainuo.doctor.common.model;

public class FileDownLoadTask {

   public   static String EXT_TMP = ".temp";
   public   static String EXT_JSON = ".json";
    public   static String EXT_TIME = ".time";

    public enum TASK_STATUS {
        STATUS_DOWNLOAD_PRE,        //准备下载
        STATUS_DOWNLOAD_PAUSE,      //暂停下载
        STATUS_DOWNLOADING,         //正在下载
        STATUS_DOWNLOAD_FINISH,     //下载完成
        STATUS_DOWNLOAD_FAILED,     //下载失败
        STATUS_DOWNLOAD_NO_EXIST    //任务不存在
    }

    //下载地址
    private String _url;

    //任务id
    private String tid;
    //任务状态
    private TASK_STATUS _status;
    //任务进度
    private float _progress;
    //文件路径
    private String _savePath;
    //下载速度
    private int _rate;
    //文件名
    private String _filename;

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    private String updateTime;
    //已下载的长度
    private int downloadedLength;
    //文件大小
    private int fileSize;


    public boolean isJsonComplete() {
        return jsonComplete;
    }

    public void setJsonComplete(boolean jsonComplete) {
        this.jsonComplete = jsonComplete;
    }

    private boolean jsonComplete;

    public String getJsonKey(){
        return  getJsonKey(tid);
    }

    public static String getJsonKey(String tid){
        return  tid+EXT_JSON;
    }

    public static String getUpdateTimeKey(String tid){
        return  tid+EXT_TIME;
    }

    public FileDownLoadTask() {
    }

    public int getDownloadedLength() {
        return downloadedLength;
    }

    public void setDownloadedLength(int downloadedLength) {
        this.downloadedLength = downloadedLength;
    }

    public int getFileSize() {
        return fileSize;
    }
    public void setFileSize(int fileSize) {
        this.fileSize = fileSize;
    }

    public String getTid() {
        return tid;
    }
    public void setTid(String tid) {
        this.tid = tid;
    }

    public String getFilename() {
        return this._filename;
    }

    public void setFilename(String aFilename) {
        this._filename = aFilename;
    }

    public String getUrl() {
        return this._url;
    }

    public void setUrl(String aUrl) {
        this._url = aUrl;
    }

    public TASK_STATUS getStatus() {
        return this._status;
    }

    public void setStatus(TASK_STATUS aStatus) {
        this._status = aStatus;
    }

    public int getProgress() {
        return (int) (_progress * 100);
    }

    public void setProgress(float aProgress) {
        this._progress = aProgress;
    }

    public String getSavePath() {
        return this._savePath;
    }

    public void setSavePath(String aSavePath) {
        this._savePath = aSavePath;
    }
    public String getTmpPath() {
        return _savePath+EXT_TMP;
    }

    public int getRate() {
        return this._rate;
    }

    public void setRate(int aRate) {
        this._rate = aRate;
    }



}